package com.ff.mapper;

import static com.ff.mapper.ShopDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.ff.model.Shop;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;

@Mapper
public interface ShopMapper {
    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    BasicColumn[] selectList = BasicColumn.columnList(sid, wid, fid, snumber, stat);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3028076+08:00", comments="Source Table: shop")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3028076+08:00", comments="Source Table: shop")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3028076+08:00", comments="Source Table: shop")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    int insert(InsertStatementProvider<Shop> insertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    @InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
    int insertMultiple(MultiRowInsertStatementProvider<Shop> multipleInsertStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("ShopResult")
    Optional<Shop> selectOne(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="ShopResult", value = {
        @Result(column="sid", property="sid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="wid", property="wid", jdbcType=JdbcType.INTEGER),
        @Result(column="fid", property="fid", jdbcType=JdbcType.INTEGER),
        @Result(column="snumber", property="snumber", jdbcType=JdbcType.INTEGER),
        @Result(column="stat", property="stat", jdbcType=JdbcType.INTEGER)
    })
    List<Shop> selectMany(SelectStatementProvider selectStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default long count(CountDSLCompleter completer) {
        return MyBatis3Utils.countFrom(this::count, shop, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int delete(DeleteDSLCompleter completer) {
        return MyBatis3Utils.deleteFrom(this::delete, shop, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int deleteByPrimaryKey(Integer sid_) {
        return delete(c -> 
            c.where(sid, isEqualTo(sid_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int insert(Shop record) {
        return MyBatis3Utils.insert(this::insert, record, shop, c ->
            c.map(sid).toProperty("sid")
            .map(wid).toProperty("wid")
            .map(fid).toProperty("fid")
            .map(snumber).toProperty("snumber")
            .map(stat).toProperty("stat")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int insertMultiple(Collection<Shop> records) {
        return MyBatis3Utils.insertMultiple(this::insertMultiple, records, shop, c ->
            c.map(sid).toProperty("sid")
            .map(wid).toProperty("wid")
            .map(fid).toProperty("fid")
            .map(snumber).toProperty("snumber")
            .map(stat).toProperty("stat")
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int insertSelective(Shop record) {
        return MyBatis3Utils.insert(this::insert, record, shop, c ->
            c.map(sid).toPropertyWhenPresent("sid", record::getSid)
            .map(wid).toPropertyWhenPresent("wid", record::getWid)
            .map(fid).toPropertyWhenPresent("fid", record::getFid)
            .map(snumber).toPropertyWhenPresent("snumber", record::getSnumber)
            .map(stat).toPropertyWhenPresent("stat", record::getStat)
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default Optional<Shop> selectOne(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectOne(this::selectOne, selectList, shop, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default List<Shop> select(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectList(this::selectMany, selectList, shop, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default List<Shop> selectDistinct(SelectDSLCompleter completer) {
        return MyBatis3Utils.selectDistinct(this::selectMany, selectList, shop, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default Optional<Shop> selectByPrimaryKey(Integer sid_) {
        return selectOne(c ->
            c.where(sid, isEqualTo(sid_))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int update(UpdateDSLCompleter completer) {
        return MyBatis3Utils.update(this::update, shop, completer);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    static UpdateDSL<UpdateModel> updateAllColumns(Shop record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(sid).equalTo(record::getSid)
                .set(wid).equalTo(record::getWid)
                .set(fid).equalTo(record::getFid)
                .set(snumber).equalTo(record::getSnumber)
                .set(stat).equalTo(record::getStat);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    static UpdateDSL<UpdateModel> updateSelectiveColumns(Shop record, UpdateDSL<UpdateModel> dsl) {
        return dsl.set(sid).equalToWhenPresent(record::getSid)
                .set(wid).equalToWhenPresent(record::getWid)
                .set(fid).equalToWhenPresent(record::getFid)
                .set(snumber).equalToWhenPresent(record::getSnumber)
                .set(stat).equalToWhenPresent(record::getStat);
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int updateByPrimaryKey(Shop record) {
        return update(c ->
            c.set(wid).equalTo(record::getWid)
            .set(fid).equalTo(record::getFid)
            .set(snumber).equalTo(record::getSnumber)
            .set(stat).equalTo(record::getStat)
            .where(sid, isEqualTo(record::getSid))
        );
    }

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2022-06-15T17:32:43.3038096+08:00", comments="Source Table: shop")
    default int updateByPrimaryKeySelective(Shop record) {
        return update(c ->
            c.set(wid).equalToWhenPresent(record::getWid)
            .set(fid).equalToWhenPresent(record::getFid)
            .set(snumber).equalToWhenPresent(record::getSnumber)
            .set(stat).equalToWhenPresent(record::getStat)
            .where(sid, isEqualTo(record::getSid))
        );
    }
}